package cn.acac.yygh.hosp.controller.user;

import cn.acac.yygh.hosp.service.DepartmentService;
import cn.acac.yygh.result.R;
import cn.acac.yygh.vo.hosp.DepartmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/hosp/department")
public class UserDepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 根据医院的编号查询医院的科室信息
     * @param hoscode
     * @return
     */
    @GetMapping("/findDeptByHoscode/{hoscode}")
    public R findDeptByHoscode(@PathVariable("hoscode")String hoscode){
        List<DepartmentVo> departmentList = departmentService.getDepartmentList(hoscode);
        return R.ok().setData("departmentList",departmentList);
    }
}
